Skip to content

Git init: prompt for branch + create GitHub remote#401

Closed
Samigos wants to merge 10 commits intoDimillian:mainfrom
Samigos:feature/git-init-github-remote
Closed

Git init: prompt for branch + create GitHub remote#401
Samigos wants to merge 10 commits intoDimillian:mainfrom
Samigos:feature/git-init-github-remote

Conversation

@Samigos
Copy link
Contributor

@Samigos Samigos commented Feb 10, 2026

Adds an Initialize Git flow for non-git workspaces.

  • Prompts for initial branch every time.
  • Initializes repo, creates an initial commit.
  • Optional: create a GitHub repo via gh, add origin, push HEAD, set default branch.
  • Makes the init modal opaque (no transparency) and fixes layering via DS z-index tokens.
  • Includes remote-mode (daemon) wiring + invoke wrapper test.

Tests:

  • npm run typecheck
  • npm test
  • npm run lint
  • cargo check (src-tauri)

@Samigos
Copy link
Contributor Author

Samigos commented Feb 10, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e700876164

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +167 to +170
if (!ok) {
setInitGitRepoPrompt((prev) =>
prev ? { ...prev, error: prev.error ?? "Failed to initialize Git repository." } : prev,
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't treat canceled init confirmation as failure

handleInitGitRepoPromptConfirm sets an error whenever initGitRepo(...) returns false, but useGitActions.initGitRepo also returns false for the intentional cancel path when the non-empty-folder ask(...) dialog is declined. In that scenario the UI now shows “Failed to initialize Git repository.” even though no operation failed, which is misleading and degrades the init flow UX. Please distinguish cancel vs. failure before setting this error.

Useful? React with 👍 / 👎.

@Samigos
Copy link
Contributor Author

Samigos commented Feb 11, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e7f8f95a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

format!("{owner}/{repo}")
};

if origin_url_before.is_none() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate existing origin matches requested repository

When origin already exists, this branch skips creating/fetching the requested full_name, but the function still pushes with git push -u origin HEAD and then patches /repos/{full_name}. In retry scenarios after a partial setup (for example, first attempt created origin but push failed), changing the repo name will push to the old origin while API calls and returned metadata target the new name, which can publish to the wrong repository and misreport what was configured.

Useful? React with 👍 / 👎.

@Samigos
Copy link
Contributor Author

Samigos commented Feb 11, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70f7c6949d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +46 to +49
let output = tokio_command("gh")
.args(args)
.current_dir(repo_root)
.output()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Set PATH when spawning gh commands

create_github_repo relies on run_gh_command, but this helper launches gh without the PATH augmentation used by run_git_command (git_env_path). In GUI-launched environments (notably macOS apps started outside a shell), Homebrew locations like /opt/homebrew/bin are often missing from PATH, so the new GitHub-repo flow fails with Failed to run gh even when gh is installed. Apply the same PATH handling (or explicit binary resolution) here so the feature works in packaged app contexts.

Useful? React with 👍 / 👎.

Comment on lines +108 to +110
if trimmed.starts_with('/') || trimmed.ends_with('/') {
return Err("Branch name cannot start or end with '/'.".to_string());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject branch names with repeated slashes

The new branch validator allows values like foo//bar, but Git rejects these refs (git init --initial-branch foo//bar fails with an invalid branch error). Because this passes validation and fails only after submitting the init flow, users hit a runtime failure instead of immediate input feedback. Add an explicit // rejection (or delegate to git check-ref-format) before running init commands.

Useful? React with 👍 / 👎.

@Samigos
Copy link
Contributor Author

Samigos commented Feb 11, 2026

@codex any other issues?

@chatgpt-codex-connector
Copy link

To use Codex here, create an environment for this repo.

@Samigos
Copy link
Contributor Author

Samigos commented Feb 11, 2026

@Dimillian I think we're good to go on this one. If you could also invoke the codex review, it'd be better.

@Dimillian
Copy link
Owner

@codex review

@Dimillian
Copy link
Owner

Screenshot 2026-02-12 at 12 43 51 PM

I think you reverted the main refactor, you probably better start from scratch

@chatgpt-codex-connector
Copy link

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Dimillian Dimillian closed this Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants